home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / include / glibmm-2.4 / glibmm / unicode.h < prev    next >
Encoding:
C/C++ Source or Header  |  2006-04-20  |  8.3 KB  |  312 lines

  1. // -*- c++ -*-
  2. // Generated by gtkmmproc -- DO NOT MODIFY!
  3. #ifndef _GLIBMM_UNICODE_H
  4. #define _GLIBMM_UNICODE_H
  5.  
  6.  
  7. /* $Id: unicode.hg,v 1.2 2003/08/20 10:31:23 murrayc Exp $ */
  8.  
  9. /* Copyright (C) 2002 The gtkmm Development Team
  10.  *
  11.  * This library is free software; you can redistribute it and/or
  12.  * modify it under the terms of the GNU Library General Public
  13.  * License as published by the Free Software Foundation; either
  14.  * version 2 of the License, or (at your option) any later version.
  15.  *
  16.  * This library is distributed in the hope that it will be useful,
  17.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  19.  * Library General Public License for more details.
  20.  *
  21.  * You should have received a copy of the GNU Library General Public
  22.  * License along with this library; if not, write to the Free
  23.  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  24.  */
  25.  
  26.  
  27. #include <glib/gmacros.h>
  28. #include <glib/gstrfuncs.h>
  29. #include <glib/gunicode.h>
  30.  
  31. // Not used, but we want to get rid of possible <ctype.h> macros.
  32. #include <cctype>
  33.  
  34. #undef isalnum
  35. #undef isalpha
  36. #undef iscntrl
  37. #undef isdigit
  38. #undef isgraph
  39. #undef islower
  40. #undef isprint
  41. #undef ispunct
  42. #undef isspace
  43. #undef isupper
  44. #undef isxdigit
  45. #undef istitle
  46. #undef isdefined
  47. #undef iswide
  48. #undef toupper
  49. #undef tolower
  50. #undef totitle
  51.  
  52.  
  53. namespace Glib
  54. {
  55.  
  56. /** @addtogroup glibmmEnums Enums and Flags */
  57.  
  58. /**
  59.  * @ingroup glibmmEnums
  60.  */
  61. enum UnicodeType
  62. {
  63.   UNICODE_CONTROL,
  64.   UNICODE_FORMAT,
  65.   UNICODE_UNASSIGNED,
  66.   UNICODE_PRIVATE_USE,
  67.   UNICODE_SURROGATE,
  68.   UNICODE_LOWERCASE_LETTER,
  69.   UNICODE_MODIFIER_LETTER,
  70.   UNICODE_OTHER_LETTER,
  71.   UNICODE_TITLECASE_LETTER,
  72.   UNICODE_UPPERCASE_LETTER,
  73.   UNICODE_COMBINING_MARK,
  74.   UNICODE_ENCLOSING_MARK,
  75.   UNICODE_NON_SPACING_MARK,
  76.   UNICODE_DECIMAL_NUMBER,
  77.   UNICODE_LETTER_NUMBER,
  78.   UNICODE_OTHER_NUMBER,
  79.   UNICODE_CONNECT_PUNCTUATION,
  80.   UNICODE_DASH_PUNCTUATION,
  81.   UNICODE_CLOSE_PUNCTUATION,
  82.   UNICODE_FINAL_PUNCTUATION,
  83.   UNICODE_INITIAL_PUNCTUATION,
  84.   UNICODE_OTHER_PUNCTUATION,
  85.   UNICODE_OPEN_PUNCTUATION,
  86.   UNICODE_CURRENCY_SYMBOL,
  87.   UNICODE_MODIFIER_SYMBOL,
  88.   UNICODE_MATH_SYMBOL,
  89.   UNICODE_OTHER_SYMBOL,
  90.   UNICODE_LINE_SEPARATOR,
  91.   UNICODE_PARAGRAPH_SEPARATOR,
  92.   UNICODE_SPACE_SEPARATOR
  93. };
  94.  
  95.  
  96. /**
  97.  * @ingroup glibmmEnums
  98.  */
  99. enum UnicodeBreakType
  100. {
  101.   UNICODE_BREAK_MANDATORY,
  102.   UNICODE_BREAK_CARRIAGE_RETURN,
  103.   UNICODE_BREAK_LINE_FEED,
  104.   UNICODE_BREAK_COMBINING_MARK,
  105.   UNICODE_BREAK_SURROGATE,
  106.   UNICODE_BREAK_ZERO_WIDTH_SPACE,
  107.   UNICODE_BREAK_INSEPARABLE,
  108.   UNICODE_BREAK_NON_BREAKING_GLUE,
  109.   UNICODE_BREAK_CONTINGENT,
  110.   UNICODE_BREAK_SPACE,
  111.   UNICODE_BREAK_AFTER,
  112.   UNICODE_BREAK_BEFORE,
  113.   UNICODE_BREAK_BEFORE_AND_AFTER,
  114.   UNICODE_BREAK_HYPHEN,
  115.   UNICODE_BREAK_NON_STARTER,
  116.   UNICODE_BREAK_OPEN_PUNCTUATION,
  117.   UNICODE_BREAK_CLOSE_PUNCTUATION,
  118.   UNICODE_BREAK_QUOTATION,
  119.   UNICODE_BREAK_EXCLAMATION,
  120.   UNICODE_BREAK_IDEOGRAPHIC,
  121.   UNICODE_BREAK_NUMERIC,
  122.   UNICODE_BREAK_INFIX_SEPARATOR,
  123.   UNICODE_BREAK_SYMBOL,
  124.   UNICODE_BREAK_ALPHABETIC,
  125.   UNICODE_BREAK_PREFIX,
  126.   UNICODE_BREAK_POSTFIX,
  127.   UNICODE_BREAK_COMPLEX_CONTEXT,
  128.   UNICODE_BREAK_AMBIGUOUS,
  129.   UNICODE_BREAK_UNKNOWN,
  130.   UNICODE_BREAK_NEXT_LINE,
  131.   UNICODE_BREAK_WORD_JOINER
  132. };
  133.  
  134.  
  135. /**
  136.  * @ingroup glibmmEnums
  137.  * @par Bitwise operators:
  138.  * <tt>%AsciiType operator|(AsciiType, AsciiType)</tt><br>
  139.  * <tt>%AsciiType operator&(AsciiType, AsciiType)</tt><br>
  140.  * <tt>%AsciiType operator^(AsciiType, AsciiType)</tt><br>
  141.  * <tt>%AsciiType operator~(AsciiType)</tt><br>
  142.  * <tt>%AsciiType& operator|=(AsciiType&, AsciiType)</tt><br>
  143.  * <tt>%AsciiType& operator&=(AsciiType&, AsciiType)</tt><br>
  144.  * <tt>%AsciiType& operator^=(AsciiType&, AsciiType)</tt><br>
  145.  */
  146. enum AsciiType
  147. {
  148.   ASCII_ALNUM = 1 << 0,
  149.   ASCII_ALPHA = 1 << 1,
  150.   ASCII_CNTRL = 1 << 2,
  151.   ASCII_DIGIT = 1 << 3,
  152.   ASCII_GRAPH = 1 << 4,
  153.   ASCII_LOWER = 1 << 5,
  154.   ASCII_PRINT = 1 << 6,
  155.   ASCII_PUNCT = 1 << 7,
  156.   ASCII_SPACE = 1 << 8,
  157.   ASCII_UPPER = 1 << 9,
  158.   ASCII_XDIGIT = 1 << 10
  159. };
  160.  
  161. /** @ingroup glibmmEnums */
  162. inline AsciiType operator|(AsciiType lhs, AsciiType rhs)
  163.   { return static_cast<AsciiType>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); }
  164.  
  165. /** @ingroup glibmmEnums */
  166. inline AsciiType operator&(AsciiType lhs, AsciiType rhs)
  167.   { return static_cast<AsciiType>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); }
  168.  
  169. /** @ingroup glibmmEnums */
  170. inline AsciiType operator^(AsciiType lhs, AsciiType rhs)
  171.   { return static_cast<AsciiType>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); }
  172.  
  173. /** @ingroup glibmmEnums */
  174. inline AsciiType operator~(AsciiType flags)
  175.   { return static_cast<AsciiType>(~static_cast<unsigned>(flags)); }
  176.  
  177. /** @ingroup glibmmEnums */
  178. inline AsciiType& operator|=(AsciiType& lhs, AsciiType rhs)
  179.   { return (lhs = static_cast<AsciiType>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs))); }
  180.  
  181. /** @ingroup glibmmEnums */
  182. inline AsciiType& operator&=(AsciiType& lhs, AsciiType rhs)
  183.   { return (lhs = static_cast<AsciiType>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs))); }
  184.  
  185. /** @ingroup glibmmEnums */
  186. inline AsciiType& operator^=(AsciiType& lhs, AsciiType rhs)
  187.   { return (lhs = static_cast<AsciiType>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); }
  188.  
  189.  
  190. /**
  191.  * @ingroup glibmmEnums
  192.  */
  193. enum NormalizeMode
  194. {
  195.   NORMALIZE_DEFAULT,
  196.   NORMALIZE_NFD,
  197.   NORMALIZE_DEFAULT_COMPOSE,
  198.   NORMALIZE_NFC = NORMALIZE_DEFAULT_COMPOSE,
  199.   NORMALIZE_ALL,
  200.   NORMALIZE_NFKD = NORMALIZE_ALL,
  201.   NORMALIZE_ALL_COMPOSE,
  202.   NORMALIZE_NFKC = NORMALIZE_ALL_COMPOSE
  203. };
  204.  
  205.  
  206. /** @defgroup Unicode Unicode Manipulation
  207.  * Functions operating on Unicode characters and UTF-8 strings.
  208.  * @{
  209.  */
  210.  
  211. namespace Unicode
  212. {
  213.  
  214. inline bool validate(gunichar uc)
  215.   { return (g_unichar_validate(uc) != 0); }
  216. inline bool isalnum(gunichar uc)
  217.   { return (g_unichar_isalnum(uc) != 0); }
  218. inline bool isalpha(gunichar uc)
  219.   { return (g_unichar_isalpha(uc) != 0); }
  220. inline bool iscntrl(gunichar uc)
  221.   { return (g_unichar_iscntrl(uc) != 0); }
  222. inline bool isdigit(gunichar uc)
  223.   { return (g_unichar_isdigit(uc) != 0); }
  224. inline bool isgraph(gunichar uc)
  225.   { return (g_unichar_isgraph(uc) != 0); }
  226. inline bool islower(gunichar uc)
  227.   { return (g_unichar_islower(uc) != 0); }
  228. inline bool isprint(gunichar uc)
  229.   { return (g_unichar_isprint(uc) != 0); }
  230. inline bool ispunct(gunichar uc)
  231.   { return (g_unichar_ispunct(uc) != 0); }
  232. inline bool isspace(gunichar uc)
  233.   { return (g_unichar_isspace(uc) != 0); }
  234. inline bool isupper(gunichar uc)
  235.   { return (g_unichar_isupper(uc) != 0); }
  236. inline bool isxdigit(gunichar uc)
  237.   { return (g_unichar_isxdigit(uc) != 0); }
  238. inline bool istitle(gunichar uc)
  239.   { return (g_unichar_istitle(uc) != 0); }
  240. inline bool isdefined(gunichar uc)
  241.   { return (g_unichar_isdefined(uc) != 0); }
  242. inline bool iswide(gunichar uc)
  243.   { return (g_unichar_iswide(uc) != 0); }
  244.  
  245. inline gunichar toupper(gunichar uc)
  246.   { return g_unichar_toupper(uc); }
  247. inline gunichar tolower(gunichar uc)
  248.   { return g_unichar_tolower(uc); }
  249. inline gunichar totitle(gunichar uc)
  250.   { return g_unichar_totitle(uc); }
  251.  
  252. inline int digit_value(gunichar uc)
  253.   { return g_unichar_digit_value(uc); }
  254. inline int xdigit_value(gunichar uc)
  255.   { return g_unichar_xdigit_value(uc); }
  256.  
  257. inline Glib::UnicodeType type(gunichar uc)
  258.   { return static_cast<Glib::UnicodeType>(static_cast<int>(g_unichar_type(uc))); }
  259.  
  260. inline Glib::UnicodeBreakType break_type(gunichar uc)
  261.   { return static_cast<Glib::UnicodeBreakType>(static_cast<int>(g_unichar_break_type(uc))); }
  262.  
  263. } // namespace Unicode
  264.  
  265.  
  266. namespace Ascii
  267. {
  268.  
  269. inline bool isalnum(char c)
  270.   { return g_ascii_isalnum(c); }
  271. inline bool isalpha(char c)
  272.   { return g_ascii_isalpha(c); }
  273. inline bool iscntrl(char c)
  274.   { return g_ascii_iscntrl(c); }
  275. inline bool isdigit(char c)
  276.   { return g_ascii_isdigit(c); }
  277. inline bool isgraph(char c)
  278.   { return g_ascii_isgraph(c); }
  279. inline bool islower(char c)
  280.   { return g_ascii_islower(c); }
  281. inline bool isprint(char c)
  282.   { return g_ascii_isprint(c); }
  283. inline bool ispunct(char c)
  284.   { return g_ascii_ispunct(c); }
  285. inline bool isspace(char c)
  286.   { return g_ascii_isspace(c); }
  287. inline bool isupper(char c)
  288.   { return g_ascii_isupper(c); }
  289. inline bool isxdigit(char c)
  290.   { return g_ascii_isxdigit(c); }
  291.  
  292. inline char tolower(char c)
  293.   { return g_ascii_tolower(c); }
  294. inline char toupper(char c)
  295.   { return g_ascii_toupper(c); }
  296.  
  297. inline int digit_value(char c)
  298.   { return g_ascii_digit_value(c); }
  299. inline int xdigit_value(char c)
  300.   { return g_ascii_xdigit_value(c); }
  301.  
  302. } // namespace Ascii
  303.  
  304.  
  305. /** @} group Unicode */
  306.  
  307. } // namespace Glib
  308.  
  309.  
  310. #endif /* _GLIBMM_UNICODE_H */
  311.  
  312.